from selenium.webdriver.common.by import By
from web_study.web_litemall_po.page_object.base_page import BasePage
from web_study.web_litemall_po.utils.log_utils import logger

# 首页
class HomePage(BasePage):

    __MENU_MALL_MANAGE = (By.XPATH, "//*[text()='商场管理']")
    __MENU_PRODUCT_CATEGORY = (By.XPATH, "//*[text()='商品类目']")

    """系统首页：进入商品类目"""
    def go_to_category(self):
        logger.info("系统首页：进入商品类目")
        # 点击菜单”商城管理“
        self.do_find(self.__MENU_MALL_MANAGE).click()
        # self.driver.find_element(By.XPATH, "//*[text()='商场管理']").click()
        # 点击菜单”商品类目“
        self.do_find(self.__MENU_PRODUCT_CATEGORY).click()
        # self.driver.find_element(By.XPATH, "//*[text()='商品类目']").click()
        # ==》类目列表页面
        from web_study.web_litemall_po.page_object.category_list_page import CategoryListPage
        return CategoryListPage(self.driver)